package tools;

import java.util.ArrayList;
import java.util.List;
import java.util.Timer;

public class TimerPool {
	List<Timer> timers = null;
	int flag=0;
	private static TimerPool pool = null;
	
	private TimerPool(){
		if(timers == null){
			timers = new ArrayList<Timer>();
			for(int i=0;i<100;i++){
				timers.add(new Timer());
			}
		}
	}
	
	public static Timer getInstance(){
		if(pool==null){
			pool = new TimerPool();
		}
		return pool.getOneTimer();
	}
	
	public Timer getOneTimer(){
		flag %=100;
		return timers.get(flag);
	}
}
